package com.voole.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.voole.dao.BaseDao;
import com.voole.dao.SysAuthorityDao;
import com.voole.entity.SysAuthority;
import com.voole.service.ISysAuthorityService;

@Service
public class SysAuthorityServiceImpl implements ISysAuthorityService {

	@Autowired
	BaseDao baseDao;
	
	@Autowired
	SysAuthorityDao sysAuthorityDao;
	
	/**
	 * 获取所有一级菜单（顶侧菜单）
	 */
	public List<SysAuthority> getList() throws Exception {
		return sysAuthorityDao.getList();
	}

	/**
	 * 新增 一级菜单
	 * @return id
	 */
	public Integer addAuthority(String authorityName, Integer sort, Integer status) throws Exception {
		SysAuthority sa = new SysAuthority();
		sa.setAuthorityname(authorityName);
		sa.setSort(sort);
		sa.setStatus(status);
		sysAuthorityDao.addSysAuthority(sa);//直接返回的是 数据库执多少条, 非ID
		return sa.getId();
	}

}
